	subroutine c_d
	include 'cst.inc' 
c*********************************************************************************************
c     Outputs of this subroutine: dc,dl,cstar
c
c	  this subroutine is used to update the large-scale diffusion
c	  coeffients (dc,dl) and the depth-, and time-averaged entrained
c	  sediment concentration (cstar) for each grid cell. because
c	  the shoreline can translate and the depths can change, this
c	  subroutine is called each time step.
c
c --- Determine the cross-, and long-shore large-scale diffusion coefs.
c     Dc and Dl changes because the shoreline changes, as D is a functions of distance
c
	do i=1,imax
	   do j=1,jshore(i)
	      yy=(jshore(i)-j)*deltay
	      dcc=dczero+dcyyy*yy
	      dc(i,j)=min(dcmax,dcc)
	      dll=dlzero+dlyyy*yy
            dl(i,j)=min(dlmax,dll)
         enddo
      enddo
c
c      determine cstar = f(h) using function that was first created in
c	 subroutine cdinit. for each grid cell cstar is determined from
c	 this function.
c
	klimit=jlimit-1
	do i=1,imax
	   do j=1,jshore(i)
	      do k=1,klimit
	         if(h(i,j).ge.hcs(k)) then
	           if(h(i,j).le.hcs(k+1)) then
	             cstar(i,j)=ccstar(k)
     +	                     +(ccstar(k+1)-ccstar(k))
     +                       *((hcs(k)-h(i,j))/(hcs(k)-hcs(k+1)))
                 endif
               endif  
            enddo
         enddo
      enddo

      return
      end